<template>
  <div class="page-container">
    <pf-table
      ref="pfTable"
      v-model="form"
      :columns="columns"
      :form-items="formItems"
      @get-table-data="getTableData"
    >
      <template #handle="{row}">
        <el-button type="text" size="small" @click="showDetail(row)">详情</el-button>
        <el-button type="text" size="small" @click="editHandle(row)">编辑</el-button>
        <el-button type="text" class="danger-text-button" size="small" @click="deleteHandle(row)">删除</el-button>
      </template>
    </pf-table>
  </div>
</template>

<script>
// import { getNoticeList, deleteNotice } from '@/api/content'

export default {
  name: 'SeckillProductList',
  components: {},
  data() {
    return {
      form: {},
      loading: false
    }
  },
  computed: {
    columns() {
      const attrs = { 'min-width': '150px' }
      return [
        { label: '产品图片', prop: 'title', attrs },
        { label: '产品名称', prop: 'views', attrs },
        { label: '价格（元）', prop: 'createTime', attrs },
        { label: '限购', prop: 'creator', attrs },
        { label: '秒杀价格（元）', prop: 'creator', attrs },
        { label: '秒杀库存', prop: 'creator', attrs },
        { label: '审核状态', prop: 'creator', attrs },
        { label: '操作', slot: 'handle', attrs: { width: '150px', fixed: 'right' }}
      ]
    },
    formItems() {
      const labelWidth = '120px'
      return [
        {
          type: 'input',
          label: '秒杀活动名称',
          prop: 'title',
          formItemAttrs: { labelWidth }
        }, {
          type: 'input',
          label: '店铺名称',
          prop: 'title',
          formItemAttrs: { labelWidth }
        }, {
          type: 'select',
          label: '秒杀活动场次',
          prop: 'dateRange',
          formItemAttrs: { labelWidth }
        }, {
          type: 'select',
          label: '审核状态',
          prop: 'dateRange',
          formItemAttrs: { labelWidth }
        }
      ]
    }
  },

  methods: {

    getTableData({ pageNo, pageSize, ...formQuery }, done) {
      this.loading = true
      // const [createStartTime = '', createEndTime = ''] = formQuery?.dateRange || []
      // const data = {
      //   pageNo,
      //   pageSize,
      //   createStartTime,
      //   createEndTime,
      //   ...formQuery
      // }
      // getNoticeList(data).then(res => {
      //   this.loading = false
      //   done({ data: res.data || [], total: res.count || 0 })
      // }).catch(() => {
      //   done({ data: [], total: 0 })
      //   this.loading = false
      // })
    },

    // 查看详情
    showDetail(row) {

    }
  }
}
</script>

<style lang="scss" scoped></style>
